package unit4.part13;

public class TemplatePattern {
    public static void main(String[] args) {
        Game game = new Football("北京", new String[]{"中国", "日本"});
        game.play();
    }
}

abstract class Game {
    protected String area;

    public Game(String area) {
        this.area = area;
    }

    void play() {
        start();
        end();
    }

    abstract void start();


    abstract void end();
}

class Football extends Game {

    private String[] teams;

    public Football(String area, String[] teams) {
        super(area);
        this.teams = teams;
    }

    @Override
    void start() {
        String content = "在" + super.area + "举办的" + String.join("和", teams) + "的比赛开始";
        System.out.println(content);
    }

    @Override
    void end() {
        System.out.println("比赛结束。");
    }
}
